package com.yilong.springcloudalibabanacos.sys.listener;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

/**
 * @ProjectName: springcloud-alibaba-yilong
 * @Package: com.yilong.springcloudalibabanacos.sys.listener
 * @ClassName: OrderedConsumerListener
 * @Author: WYL
 * @Description:
 * @Date: 2021/9/5 11:20
 * @Version: 1.0.0
 */
 @Slf4j
 @Service
 @RocketMQMessageListener(topic = "orderTopic", consumerGroup = "ordered-consumer", consumeMode = ConsumeMode.ORDERLY)
 public class OrderedConsumerListener implements RocketMQListener<String> {

     @Override
     public void onMessage(String message) {
         log.info("顺序消费，收到消息:" + message);
     }
 }
